Hi, Does anyone know what the order is when looping though links of an object using the 'for link in o<-"*" {...}" loop structure. I have an old list I need to compare for added/deleted links and want the diff of the output file to only be the changed links, not everything. Thank you very much in advance, Greg barrygp - Thu Dec 19 22:52:11 EST 2013 |
Re: DXL link looping order I think the order is link creation but I would not rely on it. Instead for each link I would create a string key like:
of course you an also leave out the source module id if you want to compare two copies of the same module or you can put the baseline version into the key if you want to differentiate between links to different module versions. You can also put in the name of the link module ... I guess you get the idea. Once you have a function that will create a key from the links, comparison is nothing more than two string skip lists (did not check the code, so forgive syntax errors):
string keyFromLink (LinkRef lr) {
// your key here
}
Skip skOldLinks = createString();
Skip skNewLinks = createString();
LinkRef lr
for lr in all (oOld<-"*") do {
string sKey = keyFromLink lr
put (skOldLinks, sKey, sKey);
}
for lr in all (oNew<-"*") do {
string sKey = keyFromLink lr
put (skNewLinks, sKey, sKey);
}
{
string sKey;
for sKey in skOldLinks do {
if (!find(skNewLinks, sKey)) { /* deleted link */ }
else { /* not modified link */ }
}
for sKey in skNewLinks do {
if (!find(skOldLinks, sKey)) { /* new link */ }
}
}
Hope that helps, regards, Mathias |